package com.ruoyi.web.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.web.domain.Paiban;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 医生排班Mapper接口
 * 
 * @author 蛤蛤
 * @date 2022-12-27
 */
public interface PaibanMapper extends BaseMapper<Paiban>
{
    /**
     * 查询医生排班
     * 
     * @param paiid 医生排班主键
     * @return 医生排班
     */
    @Select("SELECT p.*,d.doctorName doctorname FROM paiban p " +
            " INNER JOIN doctor d on (d.doctorId = p.doctorId) " +
            " WHERE p.paiId = #{paiid}")
    public Paiban selectPaibanByPaiid(Long paiid);

    /**
     * 查询医生排班列表
     * 
     * @param paiban 医生排班
     * @return 医生排班集合
     */
    @Select("<script> SELECT p.*,d.doctorName doctorname FROM paiban p " +
            " INNER JOIN doctor d on (d.doctorId = p.doctorId)" +
            " where 1=1 " +
            " <when test='doctorname!=null'> and doctorname like CONCAT('%',#{doctorname},'%')</when>" +
            " </script>")
    public List<Paiban> selectPaibanList(Paiban paiban);

    /**
     * 新增医生排班
     * 
     * @param paiban 医生排班
     * @return 结果
     */
    //public int insertPaiban(Paiban paiban);

    /**
     * 修改医生排班
     * 
     * @param paiban 医生排班
     * @return 结果
     */
    //public int updatePaiban(Paiban paiban);

    /**
     * 删除医生排班
     * 
     * @param paiid 医生排班主键
     * @return 结果
     */
    //public int deletePaibanByPaiid(Long paiid);

    /**
     * 批量删除医生排班
     * 
     * @param paiids 需要删除的数据主键集合
     * @return 结果
     */
    @Delete("delete from paiban where paiId in " +
            "<foreach item=\"paiid\" collection=\"array\" open=\"(\" separator=\",\" close=\")\"> #{paiid} </foreach>")
    public int deletePaibanByPaiids(Long[] paiids);
}
